package com.jwgf.queueprogramflash;

import java.util.List;
import java.util.concurrent.Callable;

public class EraseQueryCallable implements Callable<List<Integer>> {
    private List<Integer> spindles;

    public EraseQueryCallable(List<Integer> spindles) {
        this.spindles = spindles;
    }

    @Override
    public List<Integer> call() throws Exception {
        for (Integer spindle: spindles) {
            byte[] cmd = FlashCommand.createQueryEraseFlash(spindle);
            FlashManager.getInstance().send(cmd);
        }
        try {
            Thread.sleep(4 * 1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return FlashManager.getInstance().getEchoSpindles();
    }
}
